﻿using MainFile;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Xml;

namespace MainFrame
{
    public partial class LoadFrm : Form
    {
        public LoadFrm()
        {
            InitializeComponent();
        }
        public XmlDocument doczyk = new XmlDocument();
        public XmlDocument docznqd = new XmlDocument();
        private void LoadFrm_Load(object sender, EventArgs e)
        {
            MyWorker.WorkerReportsProgress = true;
            MyWorker.WorkerSupportsCancellation = true;  
            MyWorker.RunWorkerAsync();
        }

        private void MyWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            this.MyBar.Value = e.ProgressPercentage;
        }

        private void MyWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            string source = "http://localhost:9999/ZNQD/智能驱动解决方案描述.xml";
            string target =Application.StartupPath+"\\智能驱动解决方案描述.xml";
            if (MyFile.DownFile(source, target))
            {
                docznqd.Load("智能驱动解决方案描述.xml");
                MyWorker.ReportProgress(50);
            }
            source = "http://localhost:9999/ZYPT/资源平台组件描述.xml";
            target = Application.StartupPath + "\\资源平台组件描述.xml";
            if (MyFile.DownFile(source, target))
            {
                doczyk.Load("资源平台组件描述.xml");
                MyWorker.ReportProgress(100);
            }
        }

        private void MyWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }


    }
}
